﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace SLTimeSystem
{
    public class TimeAgent : TimerAgentBase
    {
        public override void CheckTime()
        {
            CurTime += Time.deltaTime;

            if (CurTime >= TargetTime
                && CurRepeatCount < RepeatCount)
            {
                CurRepeatCount++;
                CurTime = 0;
                if (CurRepeatCount >= RepeatCount)
                {
                    IsTimeOver = true;
                    //Agents.Remove(Agents[i]);
                    //i--;
                }
                if (OnTrigger != null)
                {
                    OnTrigger();
                }

            }
        }
    }
}
